function config($stateProvider, $urlRouterProvider, $ocLazyLoadProvider) {
    $urlRouterProvider.otherwise("/index/tag");

    $ocLazyLoadProvider.config({
        debug: false
    });
    $stateProvider
        .state('index', {
            abstract: true,
            url: "/index",
            templateUrl: "views/common/admin_content.html",
            resolve: {
                loadPlugin: function ($ocLazyLoad) {
                    return $ocLazyLoad.load([
                        {
                            name: "inspinia",
                            files: [
                                'js/controllers/navigationCtrl.js'
                            ]
                        }
                    ]);
                }
            }
        })
        .state('index.tag', {
            url: "/tag",
            templateUrl: "views/tag.html",
            data: {pageTitle: 'main'},
            resolve: {
                loadPlugin: function ($ocLazyLoad) {
                    return $ocLazyLoad.load([
                        {
                            seria: true,
                            files: ['css/plugins/dataTables/dataTables.bootstrap.css', 'js/plugins/dataTables/jquery.dataTables.js', 'js/plugins/dataTables/dataTables.bootstrap.js']
                        },
                        {
                            name: 'datatables',
                            files: ['js/plugins/dataTables/angular-datatables.min.js']
                        },
                        {
                            name: "inspinia",
                            files: [
                                'js/controllers/tagCtrl.js'
                            ]
                        }
                    ]);
                }
            }
        })
        .state('index.todo', {
            url: "/todo",
            templateUrl: "views/todo.html",
            data: {pageTitle: 'main'},
            resolve: {
                loadPlugin: function ($ocLazyLoad) {
                    return $ocLazyLoad.load([
                        {
                            seria: true,
                            files: ['css/plugins/dataTables/dataTables.bootstrap.css', 'js/plugins/dataTables/jquery.dataTables.js', 'js/plugins/dataTables/dataTables.bootstrap.js']
                        },
                        {
                            name: 'datatables',
                            files: ['js/plugins/dataTables/angular-datatables.min.js']
                        },
                        {
                            name: "inspinia",
                            files: [
                                'js/controllers/todoCtrl.js'
                            ]
                        }
                    ]);
                }
            }
        })
}
angular
    .module('inspinia')
    .config(config)
    .run(function ($rootScope, $state) {
        $rootScope.$state = $state;
    });
